<?php
namespace app\admin\controller;
use think\Controller;
use app\admin\model\Admin;
use think\captcha\Captcha;
class Jingtai extends Controller
{
    public function index(){
        $users=db('users')->where('activation',1)->select();
        foreach ( $users as $key=>$value){
            $level=getulevel($value['level']);
           $money=$level['lirun'];
           if($money>0){
               $arr=day_caps($value['id'],$money);
               if($arr[0]>0){
                   if($arr[1]==1){
                       $beizhu="日封顶";
                   }else{
                       $beizhu=$value['mobile'];
                   }
                   jifen(1,$value['id'],$money,11,1,$beizhu);
                   bonus6($value['id'],$money);
                   achievement(0,0,0,0,$money,$money,$money,0,0);
               }

               $up_level=db('users')->where('id',$value['up_userid'])->value('level');
               $level2=getulevel($up_level);
               $money2=$level2['b8']/100*$money;
               if($money2>0){
                   $arr2=day_caps($value['id'],$money2);
                   if($arr2[0]>0){
                       if($arr2[1]==1){
                           $beizhu="日封顶";
                       }else{
                           $beizhu=$value['mobile'];
                       }
                       jifen(1,$value['up_userid'],$arr2[0],13,1,$beizhu);
                       achievement(0,0,0,0,$arr2[0],$arr2[0],$arr2[0],0,0);
                   }
               }
           }
        }
    }
}